package com.example.s02_jsp.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.Date;

// @Controller 控制器


@Controller
public class HelloController {


    @RequestMapping("/hello")
    public String hello(Model m)
    {
        m.addAttribute("time",new Date());
        m.addAttribute("message","Hello world!");

        m.addAttribute("username","张三");
        m.addAttribute("salary",5000);
        String[] brands = {"华为","苹果","三星"};
        m.addAttribute("brands",brands);


        return "hello";
    }
}
